"""
@name : walden
@author : liuyi
@projectname: Demo01
@time : 2022/3/6  8:01
"""

#1234567890,.-:;?!"/
walden_dict = {}
with open("Walden.txt",encoding="utf8") as fp:
    walden = fp.read()

lst = ["\ufeff","1","2","3","4","5","6","7","8","9","0",",",".",":",";","?","!","\"","-","/","$","'","(",")","+","&","\n","`"]
for i in lst:
    walden = walden.replace(i," ")

walden = walden.lower()
walden = walden.split(" ")

for i in walden:
    if i == "":
        pass
    elif i in walden_dict.keys():
        walden_dict[i] = walden_dict[i]+1
    else:
        walden_dict[i] = 1


print(walden_dict)



